package combat.settlement.calculate;

import combat.settlement.calculate.strategies.NoDiscount;
import combat.settlement.calculate.strategies.PercentageDiscount;
import combat.settlement.calculate.strategies.ThresholdDiscount;

/**
 * @author Seon
 * @version 1.0
 * @since 2024-09-03
 */
public class DiscountFactory {
    public static DiscountStrategy createDiscountStrategy(String type) {
        return switch (type) {
            case "NoDiscount" -> new NoDiscount();

            case "PercentageDiscount" -> new PercentageDiscount(0.1); // 10%折扣

            case "ThresholdDiscount" -> new ThresholdDiscount(100, 20); // 满100减20

            default -> throw new IllegalArgumentException("Unknown discount type: " + type);
        };
    }
}
